#include <stdio.h>

int main() {
	double f, result;
	char c;
	scanf("%lf %c", &f, &c);
	if (c == 'C') {
		if (f <= -273.15) {
			printf("Invalid\n");
		} else {
			result = f * 1.8 + 32;
			printf("%.2lf F\n", result);
		}
	} else if(c == 'F') {
		result = (f - 32) / 1.8;
		if (result <= -273.15) {
			printf("Invalid\n");
		} else {
			printf("%.2lf C\n", result);
		}
	} else {
		printf("Invalid\n");
	}
	return 0;
}